document.getElementById('start').addEventListener('click', () => {
    chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
      chrome.scripting.executeScript({
        target: { tabId: tabs[0].id },
        function: () => {
          document.addEventListener('click', function(event) {
            let path = getElementPath(event.target);
            navigator.clipboard.writeText(path).then(() => {
              alert('Element path copied to clipboard: ' + path);
            });
          }, { once: true });
  
          function getElementPath(element) {
            let path = [];
            while (element.parentElement) {
              let tagName = element.tagName.toLowerCase();
              let siblingIndex = Array.from(element.parentElement.children).indexOf(element) + 1;
              path.unshift(`${tagName}:nth-child(${siblingIndex})`);
              element = element.parentElement;
            }
            path.unshift('html');
            return path.join(' >> ');
          }
        }
      });
    });
  });
  